# storage_factory.py
import configparser

from storage.local_file_storage import LocalFileStorage
from storage.local_mysql_storage import LocalMySQLStorage

class StorageFactory:
    def __init__(self, config_path='config.ini'):
        self.config = configparser.ConfigParser()
        self.config.read(config_path)

    def get_storage(self):
        storage_type = self.config.get('storage', 'type', fallback='local_file_storage').strip()
        if storage_type == 'local_file_storage':
            return LocalFileStorage("bosszhipindata")
        elif storage_type == 'local_mysql_storage':
            return LocalMySQLStorage("bosszhipindata")
        else:
            raise ValueError(f"Unknown storage type: {storage_type}")
